package org.faun.recognizer.statement;

import java.util.List;

import org.faun.recognizer.PhpExpression;
import org.faun.recognizer.PhpRecognitionException;
import org.faun.recognizer.PhpStatement;

public class EchoOperator extends PhpStatement {
	
	public List<PhpExpression> expressions = null;
	
	public boolean hasSingleExpression(){
		return (expressions != null && expressions.size() == 1);
	}
	
	public PhpExpression getFirstExpresion() throws PhpRecognitionException{
		if (expressions == null || expressions.size() < 1)
			throw new PhpRecognitionException("Echo operator has no expressions");
		return expressions.get(0);
	}
	
	public EchoOperator(List<PhpExpression> expressions){
		this.expressions = expressions;
	}
}
